var caution = false

function setCookie(name, value, expires, path, domain, secure) {
// 2010.04.02
		expires = (expires) ? expires : 0;
		path = (path) ? path : '/';
// /2010.04.02
        var curCookie = name + "=" + escape(value) +
                ((expires) ? "; expires=" + expires.toGMTString() : "") +
                ((path) ? "; path=" + path : "") +
                ((domain) ? "; domain=" + domain : "") +
                ((secure) ? "; secure" : "")
        if (!caution || (name + "=" + escape(value)).length <= 4000)
                document.cookie = curCookie
        else
                if (confirm(Dictionary.translate('lang_cookies_exceeded_size')))
                        document.cookie = curCookie
}

function getCookie(name) {
        var prefix = name + "="
        var cookieStartIndex = document.cookie.indexOf(prefix)
        if (cookieStartIndex == -1)
                return null
        var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
        if (cookieEndIndex == -1)
                cookieEndIndex = document.cookie.length
        return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}

function deleteCookie(name, path, domain) {
        if (getCookie(name)) {
                document.cookie = name + "=" + 
                ((path) ? "; path=" + path : "") +
                ((domain) ? "; domain=" + domain : "") +
                "; expires=Thu, 01-Jan-70 00:00:01 GMT"
        }
}

function changeStatus(url,text){
	var Status=getCookie("curStatus");

	if(document.location.href.indexOf("clearstatus=1")>1 || Status==null){
		Status="";
	}
	var a = new Array;
//	if(Status.length>0){
	if(Status != ""){
		a=Status.split("$");
	}

	for(var i=0; i<a.length; i=i+2){
		if(a[i+1]==text){
			a.length=i;
		}
	}
	a[a.length]=url;
	a[a.length]=text;
	Status=a.join("$");

	setCookie("curStatus",Status,"","/tables/","","");

	for(var i=0; i<a.length; i=i+2){
		if( i<a.length-2)
			document.write("&nbsp;/&nbsp;<a class=status href="+a[i]+">"+a[i+1]+"</a>");
		else
			document.write("&nbsp;/&nbsp;"+a[i+1]);
	}
}

